package com.luchao.back.service.impl;

import com.luchao.back.mapper.TypesMapper;
import com.luchao.back.pojo.Types;
import com.luchao.back.service.TypesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TypesServiceImpl implements TypesService {

    @Autowired
    private TypesMapper typesMapper;

    @Override
    public List<Types> getTypesByPage(int pageNum, int pageSize) {
        return typesMapper.getTypesByPage((pageNum - 1) * pageSize, pageSize);
    }

    @Override
    public int addTypes(Types types) {
        return typesMapper.addTypes(types);
    }

    @Override
    public int editTypes(Types types) {
        return typesMapper.editTypes(types);
    }

    @Override
    public long getTypesCount() {
        return typesMapper.getTypesCount();
    }

    @Override
    public boolean batchChangeState(List<Types> list) {
        return typesMapper.batchChangeState(list) > 0 ? true : false;
    }

    @Override
    public int checkTypes(String tname) {
        return typesMapper.checkTypes(tname);
    }

    @Override
    public List<Types> getAllTypes() {
        return typesMapper.getAllTypes();
    }

    @Override
    public List<Types> getAllTypesForView() {
        return typesMapper.getAllTypesForView();
    }
}
